package per.sunmes.lesrb.actor;

import com.badlogic.gdx.graphics.g2d.Batch;
import com.badlogic.gdx.graphics.g2d.TextureRegion;
import com.badlogic.gdx.scenes.scene2d.Actor;

import per.sunmes.lesrb.util.DU;
import per.sunmes.lesrb.util.U;

public class BlendPic extends Actor {

	TextureRegion trNormal;
	boolean isBlending;

	public BlendPic(String normal) {
		trNormal = U.region(normal);

		setSize(trNormal.getRegionWidth(), trNormal.getRegionHeight());
	}

	public boolean isBlending() {
		return isBlending;
	}

	public void setBlending(boolean isBlending) {
		this.isBlending = isBlending;
	}

	@Override
	public void draw(Batch batch, float parentAlpha) {
		DU.drawTextureByActor(batch, parentAlpha, trNormal, this);
		if (isBlending) {
			DU.drawBlendOn(batch);
			DU.drawTextureByActor(batch, parentAlpha, trNormal, this);
			DU.drawBlendOff(batch);
		}
	}

}
